<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt"%>

 <%
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/";
 %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
 		<link rel="stylesheet" type="text/css" href="<%=basePath %>/css/updateVideo.css" />
        <link rel="stylesheet" href="<%=basePath %>/css/list.css">
		<link href="<%=basePath %>/css/H-ui.min.css" rel="stylesheet" type="text/css" />
		<link href="<%=basePath %>/css/formsCSS.css" rel="stylesheet" type="text/css" />
		<link rel="stylesheet" type="text/css" href="<%=basePath %>/css/simditor.css" />
		
		<!-- select start -->
		<link href="<%=basePath %>/lib/bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css" />
		<link href="<%=basePath %>/css/multiple-select.css" rel="stylesheet" type="text/css" /> 
		<!-- select end -->
		
		<script src="<%=basePath%>/lib/My97DatePicker/WdatePicker.js"></script>
		<script src="<%=basePath %>/js/jquery.min.js"></script>
		<script src="<%=basePath %>/js/formsJS.js"></script>
		<script src="<%=basePath %>/js/jquery.form.js"></script>
		<script type="text/javascript" src="<%=basePath %>/js/module.js"></script>
		<script type="text/javascript" src="<%=basePath %>/js/hotkeys.js"></script>
		<script type="text/javascript" src="<%=basePath %>/js/uploader.js"></script>
		<script type="text/javascript" src="<%=basePath %>/js/simditor.js"></script>
		<script type="text/javascript" src="<%=basePath %>js/H-ui.js"></script>
		<script src="<%=basePath%>/js/multiple-select.js"></script> 

<script type="text/javascript">


//选中下拉框选择的值
function choice(){
	 //清空选项   
  	 /* $("#courseIds").multipleSelect("uncheckAll"); */
	/*  $("#chapterIds").multipleSelect("uncheckAll");
	 $("#cardIds").multipleSelect("uncheckAll");
	 $("#goodsIds").multipleSelect("uncheckAll"); */
	 var goodsSort = document.getElementById('goodsSort').value;
 	 if(goodsSort==1){
   		 $("#divcourseId").show();
   		 $("#divchapterId").hide();
   		 $("#divcardId").hide();
   		 $("#divgoodsId").hide();
   	 }else if(goodsSort==2){
   		 $("#divcourseId").hide();
   		 $("#divchapterId").show();
   		 $("#divcardId").hide();
   		 $("#divgoodsId").hide();
   	 }else if(goodsSort==3){
   		 $("#divcourseId").hide();
   		 $("#divchapterId").hide();
   		 $("#divcardId").show();
   		 $("#divgoodsId").hide();
   	 }else{
   		 $("#divcourseId").hide();
   		 $("#divchapterId").hide();
   		 $("#divcardId").hide();
   		 $("#divgoodsId").show();
   	 } 
	
}
function checkForm(){
 	var coinFlag =document.getElementById('coinFlag').value.trim();
	if(coinFlag==1){
		var coinValue =document.getElementById('coinValue').value.trim(); 
		if(coinValue==""){
			alert("是否返铜钱，选择是，铜钱价值不能为空");
			return false;
		}
	}
}
$(document).ready(function() { 
	  var options = {
		 	url:'<%=basePath%>goodsOrder/goodsOrderConfig',
			type:'post', 
			beforeSubmit: checkForm,//提交前验证
            success: showResponse,//成功后执行
            resetForm:true
     
		    }
	         $('#configForm').ajaxForm(options).submit(function(){
	        	return false;
	        }); 
});
 
 function showResponse(responseText, statusText)  {  
  		if(statusText="success"){
			alert("订单配置成功");
			location.reload();                            
		}else{
			alert("订单配置失败");
		}
	}  

</script>
</head>
<body>
		<div class="connect_wrap">
    		<h3 style= "text-align: center;">订单配置</h3>
			<div class="row cl" style="max-width:88%;margin-left:8%;">
			<div class="labelText"></div>
				<form  id="configForm" method="post"  
					enctype="multipart/form-data">
					<div class="col-sm-4"></div>
	    					<div class="col-sm-4">
	    							<div class="boxs">
	    							
												<input type="text" class="inputBox" placeholder="用户手机" name="telephone" value="${goodsOrder.telephone}" required="required">
												<select id="orderStatus" name="orderStatus" class="selectBox" required="required" >
												  	<option value="">订单状态</option>
										  			<%-- <option value="1" ${goodsOrder.orderStatus == 1 ? 'selected="selected"' : '' }>待付款</option>
										  			<option value="2" ${goodsOrder.orderStatus == 2 ? 'selected="selected"' : '' }>待收货</option>
										  			<option value="3" ${goodsOrder.orderStatus == 3 ? 'selected="selected"' : '' }>待评价</option> --%>
										  			<option value="4" ${goodsOrder.orderStatus == 4 ? 'selected="selected"' : '' }>已完成</option>
										  			<%-- <option value="5" ${goodsOrder.orderStatus == 5 ? 'selected="selected"' : '' }>取消订单</option> --%>
												</select>
												
												  <select id="goodsSort" name="goodsSort" class="selectBox" onchange="choice()" required="required" >
												 <!--  	<option value="">分类</option>  -->
												   	<option value="1" ${goodsOrderRelation.goodsSort == 1 ? 'selected="selected"' : '' }>课程</option>
										  			<option value="2" ${goodsOrderRelation.goodsSort == 2 ? 'selected="selected"' : '' }>章节</option>
										  			<option value="3" ${goodsOrderRelation.goodsSort == 3 ? 'selected="selected"' : '' }>年卡</option>
										  		<%-- <option value="4" ${goodsOrderRelation.goodsSort == 4 ? 'selected="selected"' : '' }>商品</option>  --%>
												</select>
												
												<div style="width:90%;margin-top:30px" id="divcourseId">
												<%-- <div class="labelText" style="position: relative; left: 0px; color: rgb(154, 144, 144);">选择课程</div>
												<select name="courseIds" id="courseIds" multiple="multiple">
									    			<c:forEach items="${courses}" var="c">
									    				<option value="${c.id}" ${c.id == goodsOrderRelation.courseId ? 'selected="selected"' : ''}>${c.id}:${c.courseName}</option>
									    			</c:forEach>
					    						</select> --%>
					    						　<div class="labelText"  style="position: relative; left: 0px; color: rgb(154, 144, 144);">选择课程</div>
						                        
						                            <select id="courseIds" name="courseIds" multiple="multiple">
						                              <c:forEach items="${courses}" var="c">
															    				<option value="${c.id}" ${c.id == goodsOrderRelation.courseId ? 'selected="selected"' : ''}>${c.id}:${c.courseName}</option>
															    			</c:forEach>
						                            </select>
						                        
					    						</div>
					    						
					    						<div style="width:90%;margin-top:30px;display:none;" id="divchapterId">
  												<%-- <div class="labelText" style="position: relative;left: 0px; color: rgb(154, 144, 144);">选择章节</div>
					    						<select name="chapterIds" id="chapterIds" multiple="multiple">
									    			<c:forEach items="${chapters}" var="c">
									    				<option value="${c.id}" ${c.id == goodsOrderRelation.chapterId ? 'selected="selected"' : ''}>${c.id}:${c.chapterName}</option>
									    			</c:forEach>
					    						</select> --%>
					    						<div class="labelText"  style="position: relative; left: 0px; color: rgb(154, 144, 144);">选择章节</div>
						                        
						                            <select id="chapterIds" name="chapterIds" multiple="multiple">
						                              <c:forEach items="${chapters}" var="c">
									    				<option value="${c.id}" ${c.id == goodsOrderRelation.chapterId ? 'selected="selected"' : ''}>${c.id}:${c.chapterName}</option>
									    			</c:forEach>
						                            </select>
					    						</div>
					    						
					    						<div style="width:90%;margin-top:30px;display:none;" id="divcardId">
  												<div class="labelText" style="position: relative; left: 0px; color: rgb(154, 144, 144);">选择年卡</div>
					    						<%-- <select name="cardIds" id="cardIds" multiple="multiple">
									    			<c:forEach items="${cards}" var="c">
									    				<option value="${c.id}" ${c.id == goodsOrderRelation.cardId ? 'selected="selected"' : ''}>${c.id}:${c.cardName}</option>
									    			</c:forEach>
					    						</select> --%>
					    						 <select id="cardIds" name="cardIds" multiple="multiple">
						                              <c:forEach items="${cards}" var="c">
									    				<option value="${c.id}" ${c.id == goodsOrderRelation.cardId ? 'selected="selected"' : ''}>${c.id}:${c.cardName}</option>
									    			</c:forEach>
						                            </select>
					    						</div>
					    						
					    						<!-- 未做多选处理 -->
					    						<div style="width:90%;margin-top:30px" id="divgoodsId">
  												<div class="labelText" style="position: relative; left: 0px; color: rgb(154, 144, 144);">选择商品</div>
					    						<%-- <select name="goodsId" id="goodsId">
									    			<c:forEach items="${goods}" var="g">
									    				<option value="${g.id}" ${g.id == goodsOrderRelation.goodsId ? 'selected="selected"' : ''}>${g.id}:${g.goodsName}</option>
									    			</c:forEach>
					    						</select> --%>
					    						 <select id="goodsId" name="goodsId" multiple="multiple">
						                              <c:forEach items="${goods}" var="c">
									    				<option value="${g.id}" ${g.id == goodsOrderRelation.goodsId ? 'selected="selected"' : ''}>${g.id}:${g.goodsName}</option>
									    			</c:forEach>
						                            </select>
					    						</div>
					    						
					    						
					    						<select id="coinFlag" name="coinFlag" class="selectBox" required="required">
												  	<option value="">是否返铜钱</option>
												  	<option value="0" ${coinLog.coinFlag == 0 ? 'selected="selected"' : '' }>否</option>
										  			<option value="1" ${coinLog.coinFlag == 1 ? 'selected="selected"' : '' }>是</option>
										  			 
												</select>
					    						<input type="text" class="inputBox" id="coinValue" placeholder="铜钱价值" name="coinValue" value="${coinLog.coinValue}" >
 												<textarea id="remark" name="remark" class="textareaBox" placeholder="配置说明"  required="required">${goodsOrder.remark}</textarea>
												 
												<br /><br />
												<input type="submit"  value="确定" class="true" />
												<input type="button"  class="false" value="取消" onclick="window.history.go(-1)">
												<ul style="color:red;">说明：
												  <li style="color:red;">1.订单配置，只适用于，用户已经预支课程费用，尚未获得视频观看权限</li>
												  <li style="color:red;">2.配置订单时，订单状态，必须选择【已完成】</li>
												  <li style="color:red;">3.配置订单时，该订单金额、商品金额都默认为0</li>
												  <li style="color:red;">4.配置订单完成后，可根据手机号在【商品订单】【订单退货】菜单中查看相关信息</li>
												</ul>  
										</div>
								</div>
					</form>
					 
					 
						 
							
						 
				 
				
			</div>
	</div>
	
</body>
<script type="text/javascript">
	$(function(){
		var goodsSort = document.getElementById('goodsSort').value.trim();   
		if(goodsSort==1){
	  		 $("#divcourseId").show();
	  		 $("#divchapterId").hide();
	  		 $("#divcardId").hide();
	  		 $("#divgoodsId").hide();
	  	 }else if(goodsSort==2){
	  		 $("#divcourseId").hide();
	  		 $("#divchapterId").show();
	  		 $("#divcardId").hide();
	  		 $("#divgoodsId").hide();
	  	 }else if(goodsSort==3){
	  		 $("#divcourseId").hide();
	  		 $("#divchapterId").hide();
	  		 $("#divcardId").show();
	  		 $("#divgoodsId").hide();
	  	 }else{
	  		 $("#divcourseId").show();
	  		 $("#divchapterId").hide();
	  		 $("#divcardId").hide();
	  		 $("#divgoodsId").hide();
	  	 } 				 
	});
	$(function() {
	   /*  $('#courseIds').multipleSelect({
	        width: '100%'
	    }).change(function(){
	    }); */
	    /* $('#chapterIds').multipleSelect({
	        width: '100%'
	    }).change(function(){
	    });
	    $('#cardIds').multipleSelect({
	        width: '100%'
	    }).change(function(){
	    });
	    $('#goodsId').multipleSelect({
	    	width:'100%'
	    }).change(function(){
	   }); */
	 //清空选项   
   	/*  $("#courseIds").multipleSelect("uncheckAll"); */
	/*  $("#chapterIds").multipleSelect("uncheckAll");
	 $("#cardIds").multipleSelect("uncheckAll");
	 $("#goodsId").multipleSelect("uncheckAll"); */
	});
	
	$(function () {
	    $('#courseIds').multipleSelect({
	        placeholder: "请选择",
	        filter: true
	    });
	}) 
$(function () {
	    $('#chapterIds').multipleSelect({
	        placeholder: "请选择",
	        filter: true
	    });
	}) 
	$(function () {
	    $('#cardIds').multipleSelect({
	        placeholder: "请选择",
	        filter: true
	    });
	}) 
	$(function () {
	    $('#"goodsId"').multipleSelect({
	        placeholder: "请选择",
	        filter: true
	    });
	}) 
</script>
	 
</html>